/****** Object:  Table [dbo].[Galleries]    Script Date: 09/30/2013 22:35:17 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Galleries](
	[GalleryId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](500) NOT NULL,
	[IsImagesGallery] [bit] NOT NULL,
	[IsFotoclub] [bit] NOT NULL,
 CONSTRAINT [PK_Galleries] PRIMARY KEY CLUSTERED 
(
	[GalleryId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[Images]    Script Date: 10/22/2013 22:49:32 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Images](
	[ImageId] [int] IDENTITY(1,1) NOT NULL,
	[Url] [nvarchar](500) NOT NULL,
	[GalleryId] [int] NOT NULL,
	[IsDefault] [bit] NOT NULL,
	[UrlThumb] [nvarchar](500) NULL,
 CONSTRAINT [PK_Images] PRIMARY KEY CLUSTERED 
(
	[ImageId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Images]  WITH CHECK ADD  CONSTRAINT [FK_Images_Galleries] FOREIGN KEY([GalleryId])
REFERENCES [dbo].[Galleries] ([GalleryId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[Images] CHECK CONSTRAINT [FK_Images_Galleries]
GO

/****** Object:  Table [dbo].[News]    Script Date: 09/30/2013 22:42:11 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[News](
	[NewsId] [int] IDENTITY(1,1) NOT NULL,
	[Header] [nvarchar](500) NOT NULL,
	[Description] [nvarchar](max) NOT NULL,
	[GalleryId] [int] NOT NULL,
 CONSTRAINT [PK_News] PRIMARY KEY CLUSTERED 
(
	[NewsId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[News]  WITH CHECK ADD  CONSTRAINT [FK_News_Galleries] FOREIGN KEY([GalleryId])
REFERENCES [dbo].[Galleries] ([GalleryId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[News] CHECK CONSTRAINT [FK_News_Galleries]
GO

/****** Object:  Table [dbo].[ScheduleDays]    Script Date: 09/30/2013 22:53:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ScheduleDays](
	[DayId] [int] IDENTITY(1,1) NOT NULL,
	[Day] [nvarchar](20) NOT NULL,
	[Date] [date] NOT NULL,
	[IsSpecialDay] [bit] NOT NULL,
 CONSTRAINT [PK_ScheduleDays] PRIMARY KEY CLUSTERED 
(
	[DayId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

/****** Object:  Table [dbo].[ScheduleServices]    Script Date: 09/30/2013 22:54:24 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ScheduleServices](
	[ServiceId] [int] IDENTITY(1,1) NOT NULL,
	[Name] [nvarchar](max) NOT NULL,
	[Time] [time](7) NOT NULL,
	[DayId] [int] NOT NULL,
 CONSTRAINT [PK_ScheduleServices] PRIMARY KEY CLUSTERED 
(
	[ServiceId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ScheduleServices]  WITH CHECK ADD  CONSTRAINT [FK_ScheduleServices_ScheduleDays] FOREIGN KEY([DayId])
REFERENCES [dbo].[ScheduleDays] ([DayId])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[ScheduleServices] CHECK CONSTRAINT [FK_ScheduleServices_ScheduleDays]
GO